<template>
<div>
    Provide
    {{ userInfo.name }}
    <Provide1></Provide1>
    <button @click="update">修改</button>
</div>
</template>
<script setup lang='ts'> 
 import {ref,reactive, provide} from 'vue';
 import Provide1 from './Provide1.vue';

 const userInfo=ref({
     name:'张三',
     age:18
 })
// provide('键',共享的数据)
 provide('user',userInfo) // 提供数据

 const update=()=>{
     userInfo.value.name='李四'
 }

</script>
<style scoped lang='less'>
</style>